<?php echo $this->element('banner');?>
<?php 
$contact1 = $contacts[0];
$contact2 = $contacts[1];
?>
<div class="container">
    <div id="sub-page" class="row">
        <div class="col-lg-12 search-result">
            <h2><?php echo __('Contact')?></h2>
			<div class="row" style="margin-top:30px; margin-bottom:20px">
            	<div class="col-lg-5">
                	<h4><?php echo h($contact1['Contact']['name' . $code]); ?></h4>
                    <p><?php echo h($contact1['Contact']['address' . $code]); ?></p>
                    <p><?php echo __('Tel')?>: <?php echo h($contact1['Contact']['tel']); ?></p>
                    <p><?php echo __('Fax')?>: <?php echo h($contact1['Contact']['fax']); ?></p>
                    <p><?php echo __('URL')?>: <?php echo h($contact1['Contact']['url']); ?></p>
                    <p><?php echo __('Contact us')?>:</p>
                    <p>USUDA KENJI ( Japanes)</p>
                    <p>PHẠM THANH QUANG ( Tiếng Việt, Jappanes)</p>
                    <p>ĐINH THỊ SANH (English)</p>
                    <br>
                    <h4><?php echo h($contact2['Contact']['name' . $code]); ?></h4>
                    <p><?php echo h($contact2['Contact']['address' . $code]); ?></p>
                    <p><?php echo __('Tel')?>: <?php echo h($contact2['Contact']['tel']); ?></p>
                    <p><?php echo __('Fax')?>: <?php echo h($contact2['Contact']['fax']); ?></p>
                    <p><?php echo __('URL')?>: <?php echo h($contact2['Contact']['url']); ?></p>
                </div>
                <div class="col-lg-6 col-lg-offset-1">
                    <form name="frm-contact" id="frm-contact" method="post" action="/contacts/send_email">
                	<h4><?php echo __('CONTACT INFO')?></h4>
                    <p><?php echo __('CONTACT_TEXT')?></p>
                    <?php echo @$this->Session->flash('flash', array('params' => array('class' => 'text-success')));?>
                    <p style="display:none" id="error"></p>
                    <label><?php echo __('Name')?></label>
                    <input name="name" id="name" type="text">
                    <label><?php echo __('Email address')?></label>
                    <input name="email" id="email" type="text">
                    <label><?php echo __('Message')?></label>
                    <textarea name="message" id="message"></textarea>
                    <p style="margin-top:20px">
                        <input class="btn btn-primary btn-lg" name="send" id="send" type="button" value="<?php echo __('Send message')?>">
                    </p>
                    </form>
                </div>
            </div>
            <div class="row">
            	<div class="col-lg-12">
                	<h4><?php echo __('Location')?></h4>
                    <iframe src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d125487.85805744941!2d106.679306!3d10.618556!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x317530bed1f060a3%3A0x70f4e114ba50e13e!2zTG9uZyBI4bqtdSwgQ-G6p24gR2l14buZYywgSOG7kyBDaMOtIE1pbmgsIFZp4buHdCBOYW0!5e0!3m2!1svi!2s!4v1420509967594" width="1140" height="366" frameborder="0" style="border:0"></iframe>
                </div>
            </div>
        </div>
        
    </div>
</div>

<?php echo $this->element('partner');?>
<script>
$(document).ready(function(){
    $('#send').click(function(){
        var name = $('#name').val();
        var email = $('#email').val();
        var message = $('#message').val();
        var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;

        if(name == '' || email== '' || message=='') {
            $('#error').html('Please input full below info.').attr('style','color:red').show();
            return;
        } else if(!pattern.test(email)) {
            $('#error').html('Email not valid').attr('style','color:red').show();
            return;
        }
    
        $('#frm-contact').submit();
    });
});
</script>
